<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main"/>
        <title>Create Issue</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton" style="float:right">
                <a class="edit" href="${createLinkTo(dir:'admin')}">Admin</a>
            </span>
            <span class="menuButton">
                <a class="home" href="${createLinkTo(dir:'')}">Home</a>
            </span>
        </div>
        <div class="body">
            <h1>Create Issue</h1>
            <g:if test="${flash.message}">
                <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${issue}">
                <div class="errors">
                    <g:renderErrors bean="${issue}" as="list"/>
                </div>
            </g:hasErrors>
            <g:form action="save" method="post">
                <div class="dialog">
                    <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="component">Component:</label>
                                </td>
                                <td valign="top"
                                    class="value ${hasErrors(bean:issue,field:'component','errors')}">
                                    <g:select optionKey="id" from="${Component.list()}"
                                        name="component.id" value="${issue?.component?.id}"/>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="type">Type:</label>
                                </td>
                                <td valign="top"
                                    class="value ${hasErrors(bean:issue,field:'type','errors')}">
                                    <g:select id="type" name="type"
                                        from="${issue.constraints.type.inList.collect{it.encodeAsHTML()}}"
                                        value="${fieldValue(bean:issue,field:'type')}"/>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="submitter">Submitter:</label>
                                </td>
                                <td valign="top"
                                    class="value ${hasErrors(bean:issue,field:'submitter','errors')}">
                                    <input type="text" id="submitter" name="submitter"
                                        value="${fieldValue(bean:issue,field:'submitter')}"/>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description">Description:</label>
                                </td>
                                <td valign="top"
                                    class="value ${hasErrors(bean:issue,field:'description','errors')}">
                                    <textarea rows="5" cols="40" name="description"
                                        >${issue?.description?.encodeAsHTML()}</textarea>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="bounty">Bounty:</label>
                                </td>
                                <td valign="top"
                                    class="value ${hasErrors(bean:issue,field:'bounty','errors')}">
                                    <input type="text" id="bounty" name="bounty"
                                        value="${fieldValue(bean:issue,field:'bounty')}" maxlength="2" style="width: 25px"/> beers (0-12)
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button">
                        <input class="save" type="submit" value="Create"/>
                    </span>
                </div>
            </g:form>
        </div>
    </body>
</html>
